*
* Authors: Jonathan Blandford <jrb@redhat.com>
* Adapted from the gimp gif filter written by Adam Moss <adam@gimp.org>
- * Gimp work based on earlier work by ......
+ * Gimp work based on earlier work.
* Permission to relicense under the LGPL obtained.
*
* This library is free software; you can redistribute it and/or
#define MAXCOLORMAPSIZE 256
-
-#define CM_RED 0
-#define CM_GREEN 1
-#define CM_BLUE 2
-
#define MAX_LZW_BITS 12
#define INTERLACE 0x40
#define BitSet(byte, bit) (((byte) & (bit)) == (bit))
#define LM_to_uint(a,b) (((b)<<8)|(a))
-#define GRAYSCALE 1
-#define COLOR 2
-
typedef unsigned char CMap[3][MAXCOLORMAPSIZE];
-
/* Possible states we can be in. */
enum {
GIF_START,
struct _Gif89
{
int transparent;
- int delay_time;
- int input_flag;
- int disposal;
};
typedef struct _GifContext GifContext;
unsigned int color_resolution;
unsigned int background;
unsigned int aspect_ratio;
- int gray_scale;
GdkPixbuf *pixbuf;
Gif89 gif89;
return -1;
}
- context->color_map[CM_RED][context->colormap_index] = rgb[0];
- context->color_map[CM_GREEN][context->colormap_index] = rgb[1];
- context->color_map[CM_BLUE][context->colormap_index] = rgb[2];
+ context->color_map[0][context->colormap_index] = rgb[0];
+ context->color_map[1][context->colormap_index] = rgb[1];
+ context->color_map[2][context->colormap_index] = rgb[2];
context->colormap_flag &= (rgb[0] == rgb[1] && rgb[1] == rgb[2]);
context->colormap_index ++;
}
- context->gray_scale = (context->colormap_flag) ? GRAYSCALE : COLOR;
-
return 0;
}
retval = get_data_block (context, (unsigned char *) context->block_buf, NULL);
if (retval != 0)
return retval;
- context->gif89.disposal = (context->block_buf[0] >> 2) & 0x7;
- context->gif89.input_flag = (context->block_buf[0] >> 1) & 0x1;
- context->gif89.delay_time = LM_to_uint (context->block_buf[1], context->block_buf[2]);
if (context->pixbuf == NULL) {
/* I only want to set the transparency if I haven't
* created the pixbuf yet. */